package com.spottydog.virtues;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;

import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

public class AboutActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);		
		getWindow().setBackgroundDrawableResource(R.drawable.paper);
		
		InputStream is = getResources().openRawResource(R.raw.about);
		Writer w = new StringWriter();
		char[] buffer = new char[1024];
		try {
			Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
			int n;
			while ((n = reader.read(buffer)) != -1) {
				w.write(buffer, 0, n);
			}
		} catch (IOException e) {
		} finally {
			try {
				is.close();
			} catch (IOException e) {
			}
		}
		
		setContentView(R.layout.about);
		
		TextView tv = (TextView) findViewById(R.id.about_text);
		tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/BenjaminFranklin.ttf"));
		tv.setText(Html.fromHtml(w.toString()));
	}

}